package com.sharer.last.service.impl;

import com.sharer.last.model.vo.blog.ArchiveBlogVO;
import com.sharer.last.model.vo.blog.ArchiveVO;
import com.sharer.last.service.ArchiveService;
import com.sharer.last.service.BlogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 归档博客
 *
 * @ClassName ArchiveServiceImpl
 * @Author WangJin
 * @Date 2023/06/30/14:49
 * @Description
 * @Version 1.0
 */
@Service
public class ArchiveServiceImpl implements ArchiveService {
    @Resource
    BlogService blogService;

    /**
     * 按年月分组归档公开博客 统计公开博客总数
     *
     * @return
     */
    @Override
    public ArchiveVO getArchiveBlogGroupByYearMonth(String adminToken) {
        List<ArchiveBlogVO> list  = blogService.selectBlogListGroupByYearMonth(adminToken);
        long                count = blogService.countBlogByIsPrivacy(adminToken);
        return ArchiveVO.builder().archiveList(list).count(count).build();
    }
}
